package org.coderjonny.service.fallback.factory;

import feign.hystrix.FallbackFactory;
import org.coderjonny.bean.User;
import org.coderjonny.dto.Request;
import org.coderjonny.dto.Result;
import org.coderjonny.dto.user.UserId;
import org.coderjonny.feign.UserService;
import org.springframework.stereotype.Component;

@Component
public class UserServiceFallbackFactory implements FallbackFactory<UserService> {
    @Override
    public UserService create(Throwable cause) {
        return new UserService() {
            @Override
            public Result<User> getByUserId(Request<UserId> request) {
                return Result.error("服务降级User");
            }
        };
    }
}
